package cn.hyxy.hadoop.writable;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Demo14_AccessLog_zhenAi2 implements WritableComparable<Demo14_AccessLog_zhenAi2> {
    private String id;
    private String name;
    private String address;
    private String state;
    private String height;
    private String age;
    private int sex;

    public Demo14_AccessLog_zhenAi2() {
    	
    }

    public Demo14_AccessLog_zhenAi2(String id, String name,String address,String state,String height, String age, int sex) {
        this.id = id;
        this.name = name;
        this.address=address;
        this.state=state;
        this.height=height;
        this.age=age;
        this.sex = sex;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(id);
        out.writeUTF(name);
        out.writeUTF(address);
        out.writeUTF(state);
        out.writeUTF(height);
        out.writeUTF(age);
        out.writeInt(sex);;
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        id = in.readUTF();
        name = in.readUTF();
        address = in.readUTF();
        state = in.readUTF();
        height = in.readUTF();
        age = in.readUTF();
        sex = in.readInt();
    }

    
    
	@Override
    public int compareTo(Demo14_AccessLog_zhenAi2 o) {
        int a = this.id.compareTo(o.id);
//        if (a == 0) {
//            a = -(int) (this.sex - o.sex);
//        }
        return a;
    }
    
 
    public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getHeight() {
		return height;
	}

	public void setHeight(String height) {
		this.height = height;
	}

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}
}
